package lobystate
{
	import flash.events.Event;
	import mx.controls.Alert;
	import mx.core.FlexGlobals;
	
	public class StateUpdateRoomTable extends NetRequestState
	{
		private static var instance:StateUpdateRoomTable = null;
		
		private var nPage:int;
		
		public function StateUpdateRoomTable()
		{
			super();		
		}
		
		public static function get Instance():StateUpdateRoomTable
		{
			if(instance == null)
				instance = new StateUpdateRoomTable();
			return instance;
		}		
		
		override public function send(obj:StateManager):void
		{
			// 显示进行过程
			LobyNetManager.Instance.showNetProcess("获得大厅内游戏桌信息中……");	
			LobyNetManager.Instance.lobbyUpdater.url = LobyNetManager.URL_lobyAddress;	
			LobyNetManager.Instance.lobbyUpdater.request = {"PROCESS":LobyNetManager.URL_tableInfo,"page":nPage};
			LobyNetManager.Instance.lobbyUpdater.send();
		}
		override public function receive(obj:Object):Boolean
		{
			if(super.receive(obj))
			{
//				Alert.show("更新Room列表");
				LobyNetManager.Instance.tabledata = obj;
				LobyManager.Instance.getintoRoom(obj);
				// 请求玩家列表
				LobyNetManager.Instance.update(LobyNetManager.updateRoomplayerlist);				
				LobyNetManager.Instance.closeNetProcess();
				return true;
			}	
			return false;
		}
		override public function fault(event:Event):void
		{

		}
		
		public function setPage(val:int):void
		{
		
		}
	}
}